﻿package org.openChart.sprite.groups 
{
	import org.openChart.display.DisplayGroup;
	import org.openChart.sprite.CommandHandler;
	
	/**
	 * ...
	 * @author Chongyuan
	 */
	public class GroupFactory 
	{
		
		public function GroupFactory() 
		{
			
		}
		
		public static function create( displayObject:DisplayGroup, commandHandler:CommandHandler):GroupSprite
		{
			var chartType:String = displayObject.parent.parent.chartType;
			//trace("creating the group sprite");
			var groupSprite:GroupSprite 
			//trace("GroupFactory", chartType);
			if (chartType.indexOf("line") > 0)
			{
				groupSprite = new LineGroupSprite(displayObject, commandHandler);
			}
			else
			{
				groupSprite = new GroupSprite(displayObject, commandHandler);
			}
			return groupSprite;
		}
	}
	
}